﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BulletData
{
    /// <summary>
    /// 攻击力
    /// </summary>
    public BaseData Atk { get; set; } = new BaseData();

    /// <summary>
    /// 子弹大小
    /// </summary>
    public BaseData BulletScale { get; set; } = new BaseData();

    /// <summary>
    /// 子弹存活时间
    /// </summary>
    public BaseData BulletLifeTime { get; set; } = new BaseData();

    /// <summary>
    /// 射速
    /// </summary>
    public BaseData BulletSpeed { get; set; } = new BaseData();

    public bool IsThrough { get; set; } = false;


    public BulletData()
    {
    }

    /// <summary>
    /// 复制一个
    /// </summary>
    /// <param name="bulletData"></param>
    public BulletData(BulletData bulletData)
    {
        Atk = bulletData.Atk;
        BulletScale = bulletData.BulletScale;
        BulletLifeTime = bulletData.BulletLifeTime;
        BulletSpeed = bulletData.BulletSpeed;
        IsThrough = bulletData.IsThrough;

    }

    public void Plus(BulletData data2)
    {
        

        BulletLifeTime = BulletLifeTime + data2.BulletLifeTime;
        BulletScale = BulletScale + data2.BulletScale;
        BulletSpeed = BulletSpeed + data2.BulletSpeed;
        Atk = Atk + data2.Atk;
        IsThrough = IsThrough || data2.IsThrough;
    }

    public void Minus(BulletData data2)
    {
        
        BulletLifeTime = BulletLifeTime - data2.BulletLifeTime;
        BulletScale = BulletScale - data2.BulletScale;
        BulletSpeed = BulletSpeed - data2.BulletSpeed;
        Atk = Atk - data2.Atk;
        if (data2.IsThrough)
        {
            IsThrough = false;
        }
    }
}
